﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Plantillanoheader.master" AutoEventWireup="true" CodeFile="GestionarCategorias.aspx.cs" Inherits="PagAdmin_GestionarCategorias" %>
<%@ Register Src="~/controles/FileUploader.ascx" TagName="FileUploader" TagPrefix="mb" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="headerslider" Runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="bodyprincipal" Runat="Server">
<h3>Gestionar Categorias</h3>
       <asp:ObjectDataSource ID="objAllCategories" runat="server" SelectMethod="GetCategories"
        TypeName="IUAP.BLL.Articulo.Categoria" DeleteMethod="DeleteCategory">
    </asp:ObjectDataSource>
    <asp:GridView ID="gvwCategories" runat="server" AutoGenerateColumns="False" 
           DataSourceID="objAllCategories" Width="100%" DataKeyNames="Id" 
           OnRowDeleted="gvwCategories_RowDeleted" OnRowCreated="gvwCategories_RowCreated" 
           OnSelectedIndexChanged="gvwCategories_SelectedIndexChanged" ShowHeader="False">
      <Columns>
         <asp:ImageField DataImageUrlField="imgurl_cate">
            <ItemStyle Width="100px" />
         </asp:ImageField>
         <asp:TemplateField>
            <ItemTemplate>
               <h4 class="txt1">
               <asp:Literal runat="server" ID="lblCatTitle" Text='<%# Eval("titu_cate") %>' />
               </h4>
               <asp:Literal runat="server" ID="lblDescription" Text='<%# Eval("desc_cate") %>' />
            </ItemTemplate>
         </asp:TemplateField>
         <asp:HyperLinkField Text="<img border='0' src='../Images/ArrowR.gif' alt='Ver Articulos' />"
            DataNavigateUrlFormatString="GestionarArticulo.aspx?CatID={0}" DataNavigateUrlFields="Id">
            <ItemStyle HorizontalAlign="Center" Width="20px" />
         </asp:HyperLinkField>
         <asp:CommandField ButtonType="Image" SelectImageUrl="~/Images/Edit.gif" SelectText="Edit category" ShowSelectButton="True">
            <ItemStyle HorizontalAlign="Center" Width="20px" />
         </asp:CommandField>
         <asp:CommandField ButtonType="Image" DeleteImageUrl="~/Images/Delete.gif" DeleteText="Delete category" ShowDeleteButton="True">
            <ItemStyle HorizontalAlign="Center" Width="20px" />
         </asp:CommandField>
      </Columns>
      <EmptyDataTemplate><b>No hay ninguna categoria registrada.</b></EmptyDataTemplate>   
   </asp:GridView>
    <p></p>
       <asp:ObjectDataSource ID="objCurrCategory" runat="server" 
           InsertMethod="InsertCategory" SelectMethod="GetCategoryByID" 
           TypeName="IUAP.BLL.Articulo.Categoria" UpdateMethod="UpdateCategory">
      <SelectParameters>
         <asp:ControlParameter ControlID="gvwCategories" Name="Id" PropertyName="SelectedValue"
            Type="Int32"/>
      </SelectParameters>
   </asp:ObjectDataSource>
   <div class="boxcoment" id="boxcomment">
   <asp:DetailsView ID="dvwCategory" runat="server" AutoGenerateRows="False" 
           DataSourceID="objCurrCategory" Height="50px" Width="93%" 
           AutoGenerateEditButton="True" AutoGenerateInsertButton="True" 
           HeaderText="Detalle de Categoria" OnItemInserted="dvwCategory_ItemInserted" 
           OnItemUpdated="dvwCategory_ItemUpdated" DataKeyNames="Id" 
           OnItemCreated="dvwCategory_ItemCreated" DefaultMode="Insert" 
           OnItemCommand="dvwCategory_ItemCommand" BorderStyle="None" HeaderStyle-CssClass="txt2" RowStyle-CssClass="boxcomenttr">
      <FieldHeaderStyle Width="100px" />
      <Fields>
         <asp:BoundField HeaderStyle-CssClass="txt1" DataField="Id" HeaderText="Id" ReadOnly="True" SortExpression="Id" InsertVisible="False" FooterStyle-BorderStyle="None" HeaderStyle-BorderStyle="None" >
         <ControlStyle BorderStyle="None" CssClass="boxcomenttr" />
          <FooterStyle BorderStyle="None" />
          <HeaderStyle BorderStyle="None" />
          <ItemStyle BorderStyle="None" />
          </asp:BoundField>
         <asp:BoundField HeaderStyle-CssClass="txt1" DataField="Fecha" HeaderText="Fecha" InsertVisible="False"
            ReadOnly="True" SortExpression="fecha_cate" >
            <ControlStyle BorderStyle="None" CssClass="boxcomenttr" />
          <FooterStyle BorderStyle="None" />
          <HeaderStyle BorderStyle="None" />
          <ItemStyle BorderStyle="None" />
          </asp:BoundField>
         <asp:BoundField HeaderStyle-CssClass="txt1" DataField="Usuario" HeaderText="Usuario" InsertVisible="False" ReadOnly="True"
            SortExpression="usua_cate" >
            <ControlStyle BorderStyle="None" CssClass="boxcomenttr" />
          <FooterStyle BorderStyle="None" />
          <HeaderStyle BorderStyle="None" />
          <ItemStyle BorderStyle="None" />
          </asp:BoundField>
         <asp:TemplateField HeaderText="Titulo" SortExpression="titu_cate" ControlStyle-BorderStyle="None" ControlStyle-BorderWidth="0" FooterStyle-BorderStyle="None" FooterStyle-BorderWidth="0" HeaderStyle-BorderStyle="None" HeaderStyle-BorderWidth="0" ItemStyle-BorderStyle="None" ItemStyle-CssClass="boxcomenttr" HeaderStyle-CssClass="txt1">
            <ItemTemplate>
               <asp:Label ID="lblTitle" runat="server" Text='<%# Eval("titu_cate") %>'></asp:Label>
            </ItemTemplate>
            <EditItemTemplate>
               <asp:TextBox ID="txtTitle" runat="server" Text='<%# Bind("titu_cate") %>' MaxLength="256" Width="100%"></asp:TextBox>
               <asp:RequiredFieldValidator ID="valRequireTitle" runat="server" ControlToValidate="txtTitle" SetFocusOnError="true"
                  Text="El titulo es necesario." ToolTip="The Title field is required." Display="Dynamic" CssClass="error"></asp:RequiredFieldValidator>
            </EditItemTemplate>
<ControlStyle BorderWidth="0px" BorderStyle="None"></ControlStyle>
<FooterStyle BorderWidth="0px" BorderStyle="None"></FooterStyle>
<HeaderStyle BorderWidth="0px" BorderStyle="None" CssClass="txt1"></HeaderStyle>
<ItemStyle BorderStyle="None" CssClass="boxcomenttr"/>
         </asp:TemplateField>
         <asp:TemplateField HeaderText="Importancia" SortExpression="impo_cate" ControlStyle-BorderStyle="None" ControlStyle-BorderWidth="0" FooterStyle-BorderStyle="None" FooterStyle-BorderWidth="0" HeaderStyle-BorderStyle="None" HeaderStyle-BorderWidth="0" ItemStyle-BorderStyle="None" ItemStyle-CssClass="boxcomenttr" HeaderStyle-CssClass="txt1">
            <ItemTemplate>
               <asp:Label ID="lblImportance" runat="server" Text='<%# Eval("impo_cate") %>'></asp:Label>
            </ItemTemplate>
            <EditItemTemplate>
               <asp:TextBox ID="txtImportance" runat="server" Text='<%# Bind("impo_cate") %>' MaxLength="256" Width="100%"></asp:TextBox>
               <asp:RequiredFieldValidator ID="valRequireImportance" runat="server" ControlToValidate="txtImportance" SetFocusOnError="true"
                  Text="La importancia es necesaria." ToolTip="The Importance field is required." Display="Dynamic" CssClass="error"></asp:RequiredFieldValidator>
               <asp:CompareValidator ID="valImportanceType" runat="server" Operator="DataTypeCheck" Type="Integer"
                  ControlToValidate="txtImportance" Text="El valor de la importancia debe ser un valor entero."
                  ToolTip="The Importance must be an integer." Display="dynamic" CssClass="error" />
            </EditItemTemplate>
<ControlStyle BorderWidth="0px" BorderStyle="None"></ControlStyle>
<FooterStyle BorderWidth="0px" BorderStyle="None"></FooterStyle>
<HeaderStyle BorderWidth="0px" BorderStyle="None" CssClass="txt1"></HeaderStyle>
<ItemStyle BorderStyle="None" CssClass="boxcomenttr"/>
         </asp:TemplateField>
         <asp:TemplateField HeaderText="Imagen" ConvertEmptyStringToNull="False" ControlStyle-BorderStyle="None" ControlStyle-BorderWidth="0" FooterStyle-BorderStyle="None" FooterStyle-BorderWidth="0" HeaderStyle-BorderStyle="None" HeaderStyle-BorderWidth="0" ItemStyle-BorderStyle="None" ItemStyle-CssClass="boxcomenttr" HeaderStyle-CssClass="txt1">
            <ItemTemplate>
               <asp:Image ID="imgImage" runat="server" ImageUrl='<%# Eval("imgurl_cate") %>' 
                  AlternateText='<%# Eval("imgurl_cate") %>'
                  Visible='<%# !string.IsNullOrEmpty(DataBinder.Eval(Container.DataItem, "imgurl_cate").ToString()) %>' />
            </ItemTemplate>
            <EditItemTemplate>
               <asp:TextBox ID="txtImageUrl" runat="server" Text='<%# Bind("imgurl_cate") %>' MaxLength="256" Width="100%"></asp:TextBox>
            </EditItemTemplate>
<ControlStyle BorderWidth="0px" BorderStyle="None"></ControlStyle>
<FooterStyle BorderWidth="0px" BorderStyle="None"></FooterStyle>
<HeaderStyle BorderWidth="0px" BorderStyle="None" CssClass="txt1"></HeaderStyle>
<ItemStyle BorderStyle="None" CssClass="boxcomenttr"/>
         </asp:TemplateField>
         <asp:TemplateField HeaderText="Descripcion" SortExpression="desc_cate" ConvertEmptyStringToNull="False" ControlStyle-BorderStyle="None" ControlStyle-BorderWidth="0" FooterStyle-BorderStyle="None" FooterStyle-BorderWidth="0" HeaderStyle-BorderStyle="None" HeaderStyle-BorderWidth="0" ItemStyle-BorderStyle="None" ItemStyle-CssClass="boxcomenttr" HeaderStyle-CssClass="txt1">
            <ItemTemplate>
               <asp:Label ID="lblDescription" runat="server" Text='<%# Eval("desc_cate") %>' Width="100%"></asp:Label>
            </ItemTemplate>
            <EditItemTemplate>
               <asp:TextBox ID="txtDescription" runat="server" Text='<%# Bind("desc_cate") %>' Rows="5" TextMode="MultiLine" MaxLength="4000" Width="100%"></asp:TextBox>
            </EditItemTemplate>
<ControlStyle BorderWidth="0px" BorderStyle="None"></ControlStyle>
<FooterStyle BorderWidth="0px" BorderStyle="None"></FooterStyle>
<HeaderStyle BorderWidth="0px" BorderStyle="None" CssClass="txt1"></HeaderStyle>
<ItemStyle BorderStyle="None" CssClass="boxcomenttr"/>
         </asp:TemplateField>
      </Fields>
       <RowStyle BorderStyle="None" />
   </asp:DetailsView>
   </div>
   <p></p>
   <mb:FileUploader ID="FileUploader1" runat="server" />
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="titulocolum" Runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="bodycolleft" Runat="Server">
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="bodycolright" Runat="Server">
</asp:Content>
